Skip to contentSkip to conversation

Change in openvpn[master]: Fix DNS options duplication on PUSH_UPDATE

Openvpn-devel In review stipa (Code Review) 2 participants 11 messages Jul 31, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1753959374000.Ife4d8fc5f8e2183e61226d66a76bbaa02c06f787@...2715...

#1 lore raw

Attention is currently required from: flichtenheld, plaisthos.

Hello plaisthos, flichtenheld,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1121?usp=email

to review the following change.

Change subject: Fix DNS options duplication on PUSH_UPDATE
......................................................................

Fix DNS options duplication on PUSH_UPDATE

Commit

2dfc4f ("dns: deal with --dhcp-options when --dns is active")

has removed reset of tuntap DNS options. Due to that, incoming --dns options are added to existing ones instead of overwriting them.

It has also added a new storage for --dhcp-option. The push-update code didn't clear it and as a result, incoming --dhcp-option options were added to existing once instead of overwriting them.

Fixed by:

- reseting tuntap DNS options (regression from abovementioned commit)
- clearing dhcp options storage in push-update code

Change-Id Ife4d8fc5f8e2183e61226d66a76bbaa02c06f787

---
M src/openvpn/options.c

1 file changed, 14 insertions(+), 0 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/21/1121/1

src/openvpn/options.c +14 -0
index 3753810..8ce57ff 100644
@@ -3527,7 +3527,13 @@
 #endif /* if defined(_WIN32) */
 
     /* Copy --dns options to tuntap_options */
+
     const struct dns_domain *d = dns->search_domains;
+    if (d)
+    {
+        tt->domain_search_list_len = 0;
+    }
+
     while (d && tt->domain_search_list_len + 1 < N_SEARCH_LIST_LEN)
     {
         tt->domain_search_list[tt->domain_search_list_len++] = d->name;
@@ -3539,6 +3545,12 @@
     }
 
     const struct dns_server *s = dns->servers;
+    if (s)
+    {
+        tt->dns_len = 0;
+        tt->dns6_len = 0;
+    }
+
     while (s)
     {
         bool non_standard_server_port = false;
@@ -6212,6 +6224,8 @@
             }
             o->disable_nbt = 0;
             o->dhcp_options = 0;
+
+            CLEAR(options->dns_options.from_dhcp);
 #if defined(TARGET_ANDROID)
             o->http_proxy_port = 0;
             o->http_proxy = NULL;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1121?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ife4d8fc5f8e2183e61226d66a76bbaa02c06f787
Gerrit-Change-Number: 1121
Gerrit-PatchSet: 1
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

Hello flichtenheld, plaisthos,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1121?usp=email

to look at the new patch set (#2).

Change subject: Fix DNS options duplication on PUSH_UPDATE
......................................................................

Fix DNS options duplication on PUSH_UPDATE

Commit

2dfc4f ("dns: deal with --dhcp-options when --dns is active")

has removed reset of tuntap DNS options. Due to that, incoming --dns options are added to existing ones instead of overwriting them.

It has also added a new storage for --dhcp-option. The push-update code didn't clear it and as a result, incoming --dhcp-option options were added to existing once instead of overwriting them.

Fixed by:

- reseting tuntap DNS options (regression from abovementioned commit)
- clearing dhcp options storage in push-update code

GitHub: fixes OpenVPN/openvpn#804

Change-Id Ife4d8fc5f8e2183e61226d66a76bbaa02c06f787

---
M src/openvpn/options.c

1 file changed, 14 insertions(+), 0 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/21/1121/2

src/openvpn/options.c +14 -0
index 3753810..8ce57ff 100644
@@ -3527,7 +3527,13 @@
 #endif /* if defined(_WIN32) */
 
     /* Copy --dns options to tuntap_options */
+
     const struct dns_domain *d = dns->search_domains;
+    if (d)
+    {
+        tt->domain_search_list_len = 0;
+    }
+
     while (d && tt->domain_search_list_len + 1 < N_SEARCH_LIST_LEN)
     {
         tt->domain_search_list[tt->domain_search_list_len++] = d->name;
@@ -3539,6 +3545,12 @@
     }
 
     const struct dns_server *s = dns->servers;
+    if (s)
+    {
+        tt->dns_len = 0;
+        tt->dns6_len = 0;
+    }
+
     while (s)
     {
         bool non_standard_server_port = false;
@@ -6212,6 +6224,8 @@
             }
             o->disable_nbt = 0;
             o->dhcp_options = 0;
+
+            CLEAR(options->dns_options.from_dhcp);
 #if defined(TARGET_ANDROID)
             o->http_proxy_port = 0;
             o->http_proxy = NULL;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1121?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ife4d8fc5f8e2183e61226d66a76bbaa02c06f787
Gerrit-Change-Number: 1121
Gerrit-PatchSet: 2
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset

#3 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos, stipa.

d12fk has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/1121?usp=email )

Change subject: Fix DNS options duplication on PUSH_UPDATE
......................................................................

Patch Set 2:

(4 comments)

Commit Message:

http://gerrit.openvpn.net/c/openvpn/+/1121/comment/cc9f9b67_aace83f8 :
PS2, Line 18: were added to existing once instead of overwriting them. *existing ones

http://gerrit.openvpn.net/c/openvpn/+/1121/comment/6f40d257_3c5dd855 :
PS2, Line 22: - reseting tuntap DNS options (regression from abovementioned commit) *resetting

File src/openvpn/options.c:

http://gerrit.openvpn.net/c/openvpn/+/1121/comment/769a02c7_b70d0065 :
PS2, Line 3548: if (s)
s will never be NULL here, in that case we'd branched to /* Copy --dhcp-options to tuntap_options */ above already

http://gerrit.openvpn.net/c/openvpn/+/1121/comment/c0668a3d_ef605be7 :
PS2, Line 6227:
This code should instead store the DNS related things in options->dns_options.from_dhcp. Using tuntap_options directly is not how it is done any longer. Instead "values" of whatever origin are copied to tuntap_options during the postprocess stage if needed.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1121?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ife4d8fc5f8e2183e61226d66a76bbaa02c06f787
Gerrit-Change-Number: 1121
Gerrit-PatchSet: 2
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: d12fk <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Thu, 31 Jul 2025 12:07:39 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

#4 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos, stipa.

Hello flichtenheld, plaisthos,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1121?usp=email

to look at the new patch set (#3).

Change subject: Fix DNS options duplication on PUSH_UPDATE
......................................................................

Fix DNS options duplication on PUSH_UPDATE

Commit

2dfc4f ("dns: deal with --dhcp-options when --dns is active")

has removed reset of tuntap DNS options. Due to that, incoming --dns options are added to existing ones instead of overwriting them.

It has also added a new storage for --dhcp-option. The push-update code didn't clear it and as a result, incoming --dhcp-option options were added to existing ones instead of overwriting them.

Fixed by:

- resetting tuntap DNS options (regression from abovementioned commit)
- clearing dhcp options storage in push-update code

GitHub: fixes OpenVPN/openvpn#804

Change-Id Ife4d8fc5f8e2183e61226d66a76bbaa02c06f787

---
M src/openvpn/options.c

1 file changed, 11 insertions(+), 0 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/21/1121/3

src/openvpn/options.c +11 -0
index 3753810..3ceada0 100644
@@ -3527,7 +3527,13 @@
 #endif /* if defined(_WIN32) */
 
     /* Copy --dns options to tuntap_options */
+
     const struct dns_domain *d = dns->search_domains;
+    if (d)
+    {
+        tt->domain_search_list_len = 0;
+    }
+
     while (d && tt->domain_search_list_len + 1 < N_SEARCH_LIST_LEN)
     {
         tt->domain_search_list[tt->domain_search_list_len++] = d->name;
@@ -3538,6 +3544,9 @@
         msg(M_WARN, "WARNING: couldn't copy all --dns search-domains to TUN/TAP");
     }
 
+    tt->dns_len = 0;
+    tt->dns6_len = 0;
+
     const struct dns_server *s = dns->servers;
     while (s)
     {
@@ -6212,6 +6221,8 @@
             }
             o->disable_nbt = 0;
             o->dhcp_options = 0;
+
+            CLEAR(options->dns_options.from_dhcp);
 #if defined(TARGET_ANDROID)
             o->http_proxy_port = 0;
             o->http_proxy = NULL;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1121?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ife4d8fc5f8e2183e61226d66a76bbaa02c06f787
Gerrit-Change-Number: 1121
Gerrit-PatchSet: 3
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: d12fk <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-MessageType: newpatchset

#5 lore raw
In reply to a message not in the archive

Attention is currently required from: d12fk, flichtenheld, plaisthos.

stipa has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/1121?usp=email )

Change subject: Fix DNS options duplication on PUSH_UPDATE
......................................................................

Patch Set 2:

(4 comments)

Commit Message:

http://gerrit.openvpn.net/c/openvpn/+/1121/comment/0cd9cff6_537c22be :
PS2, Line 18: were added to existing once instead of overwriting them.

Quoted 1 line

*existing ones

Acknowledged

http://gerrit.openvpn.net/c/openvpn/+/1121/comment/4febbb73_89ff723d :
PS2, Line 22: - reseting tuntap DNS options (regression from abovementioned commit)

Quoted 1 line

*resetting

Acknowledged

File src/openvpn/options.c:

http://gerrit.openvpn.net/c/openvpn/+/1121/comment/d5dc85c6_45b16c8c :
PS2, Line 3548: if (s)

Quoted 1 line

s will never be NULL here, in that case we'd branched to /* Copy --dhcp-options to tuntap_options */ […]

Acknowledged

http://gerrit.openvpn.net/c/openvpn/+/1121/comment/472f0a8d_8ef94cd9 :
PS2, Line 6227:

Quoted 1 line

This code should instead store the DNS related things in options->dns_options.from_dhcp. […]

but we don't store anything here - just nullifying tuntap_options and calling add_option(), which does the right thing by storing data in from_dhcp.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1121?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ife4d8fc5f8e2183e61226d66a76bbaa02c06f787
Gerrit-Change-Number: 1121
Gerrit-PatchSet: 2
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: d12fk <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: d12fk <[email protected]...>
Gerrit-Comment-Date: Thu, 31 Jul 2025 12:19:28 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: d12fk <[email protected]...>
Gerrit-MessageType: comment

#6 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos, stipa.

d12fk has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/1121?usp=email )

Change subject: Fix DNS options duplication on PUSH_UPDATE
......................................................................

Patch Set 3:

(1 comment)

File src/openvpn/options.c:

http://gerrit.openvpn.net/c/openvpn/+/1121/comment/d515ce38_997af3de :
PS2, Line 6227:

Quoted 1 line

but we don't store anything here - just nullifying tuntap_options and calling add_option(), which do […]

Ah yes, misjudged where this code is actually located, thought it was the regular option processing. All good here.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1121?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ife4d8fc5f8e2183e61226d66a76bbaa02c06f787
Gerrit-Change-Number: 1121
Gerrit-PatchSet: 3
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: d12fk <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Thu, 31 Jul 2025 12:22:32 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: d12fk <[email protected]...>
Comment-In-Reply-To: stipa <[email protected]...>
Gerrit-MessageType: comment

#7 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos, stipa.

d12fk has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/1121?usp=email )

Change subject: Fix DNS options duplication on PUSH_UPDATE
......................................................................

Patch Set 3: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1121?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ife4d8fc5f8e2183e61226d66a76bbaa02c06f787
Gerrit-Change-Number: 1121
Gerrit-PatchSet: 3
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Thu, 31 Jul 2025 12:23:00 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#8 lore raw

PATCH v3 1/1 Fix DNS options duplication on PUSH_UPDATE

In reply to a message not in the archive

From: Lev Stipakov <[email protected]...>

Commit

2dfc4f ("dns: deal with --dhcp-options when --dns is active")

has removed reset of tuntap DNS options. Due to that, incoming --dns options are added to existing ones instead of overwriting them.

It has also added a new storage for --dhcp-option. The push-update code didn't clear it and as a result, incoming --dhcp-option options were added to existing ones instead of overwriting them.

Fixed by:

- resetting tuntap DNS options (regression from abovementioned commit)
- clearing dhcp options storage in push-update code

GitHub: fixes OpenVPN/openvpn#804

Change-Id Ife4d8fc5f8e2183e61226d66a76bbaa02c06f787

---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1121
This mail reflects revision 3 of this Change.

Acked-by according to Gerrit (reflected above):
Heiko Hund <[email protected]...>

src/openvpn/options.c +11 -0
index 3753810..3ceada0 100644
@@ -3527,7 +3527,13 @@
 #endif /* if defined(_WIN32) */
 
     /* Copy --dns options to tuntap_options */
+
     const struct dns_domain *d = dns->search_domains;
+    if (d)
+    {
+        tt->domain_search_list_len = 0;
+    }
+
     while (d && tt->domain_search_list_len + 1 < N_SEARCH_LIST_LEN)
     {
         tt->domain_search_list[tt->domain_search_list_len++] = d->name;
@@ -3538,6 +3544,9 @@
         msg(M_WARN, "WARNING: couldn't copy all --dns search-domains to TUN/TAP");
     }
 
+    tt->dns_len = 0;
+    tt->dns6_len = 0;
+
     const struct dns_server *s = dns->servers;
     while (s)
     {
@@ -6212,6 +6221,8 @@
             }
             o->disable_nbt = 0;
             o->dhcp_options = 0;
+
+            CLEAR(options->dns_options.from_dhcp);
 #if defined(TARGET_ANDROID)
             o->http_proxy_port = 0;
             o->http_proxy = NULL;
#9 lore raw

[Openvpn-devel] [PATCH applied] Re: Fix DNS options duplication on PUSH_UPDATE

This looks generally reasonable, and if Heiko (who understands the "DNS related data flow" around options.c way better than I do) says this is fine, it should be :-) - so, in it goes, just in time for Alpha3...

Test compiled on Windows/MinGW (as the buildbots are busy and I am impatient).

Your patch has been applied to the master branch.

commit 70d4c6776bd563f487add399bd4acf58c5e22334

Author: Lev Stipakov
Date:   Thu Jul 31 14:24:05 2025 +0200
     Fix DNS options duplication on PUSH_UPDATE

     Signed-off-by: Lev Stipakov <[email protected]...>
     Acked-by: Heiko Hund <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg32448.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#10 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#4) to the change originally created by stipa. ( http://gerrit.openvpn.net/c/openvpn/+/1121?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by d12fk

Change subject: Fix DNS options duplication on PUSH_UPDATE
......................................................................

Fix DNS options duplication on PUSH_UPDATE

Commit

2dfc4f ("dns: deal with --dhcp-options when --dns is active")

has removed reset of tuntap DNS options. Due to that, incoming --dns options are added to existing ones instead of overwriting them.

It has also added a new storage for --dhcp-option. The push-update code didn't clear it and as a result, incoming --dhcp-option options were added to existing ones instead of overwriting them.

Fixed by:

- resetting tuntap DNS options (regression from abovementioned commit)
- clearing dhcp options storage in push-update code

GitHub: fixes OpenVPN/openvpn#804

Change-Id Ife4d8fc5f8e2183e61226d66a76bbaa02c06f787

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg32448.html

---
M src/openvpn/options.c

1 file changed, 11 insertions(+), 0 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/21/1121/4

src/openvpn/options.c +11 -0
index 3753810..3ceada0 100644
@@ -3527,7 +3527,13 @@
 #endif /* if defined(_WIN32) */
 
     /* Copy --dns options to tuntap_options */
+
     const struct dns_domain *d = dns->search_domains;
+    if (d)
+    {
+        tt->domain_search_list_len = 0;
+    }
+
     while (d && tt->domain_search_list_len + 1 < N_SEARCH_LIST_LEN)
     {
         tt->domain_search_list[tt->domain_search_list_len++] = d->name;
@@ -3538,6 +3544,9 @@
         msg(M_WARN, "WARNING: couldn't copy all --dns search-domains to TUN/TAP");
     }
 
+    tt->dns_len = 0;
+    tt->dns6_len = 0;
+
     const struct dns_server *s = dns->servers;
     while (s)
     {
@@ -6212,6 +6221,8 @@
             }
             o->disable_nbt = 0;
             o->dhcp_options = 0;
+
+            CLEAR(options->dns_options.from_dhcp);
 #if defined(TARGET_ANDROID)
             o->http_proxy_port = 0;
             o->http_proxy = NULL;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1121?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ife4d8fc5f8e2183e61226d66a76bbaa02c06f787
Gerrit-Change-Number: 1121
Gerrit-PatchSet: 4
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset

#11 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1121?usp=email )

Change subject: Fix DNS options duplication on PUSH_UPDATE
......................................................................

Fix DNS options duplication on PUSH_UPDATE

Commit

2dfc4f ("dns: deal with --dhcp-options when --dns is active")

has removed reset of tuntap DNS options. Due to that, incoming --dns options are added to existing ones instead of overwriting them.

It has also added a new storage for --dhcp-option. The push-update code didn't clear it and as a result, incoming --dhcp-option options were added to existing ones instead of overwriting them.

Fixed by:

- resetting tuntap DNS options (regression from abovementioned commit)
- clearing dhcp options storage in push-update code

GitHub: fixes OpenVPN/openvpn#804

Change-Id Ife4d8fc5f8e2183e61226d66a76bbaa02c06f787

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg32448.html

---
M src/openvpn/options.c

1 file changed, 11 insertions(+), 0 deletions(-)
src/openvpn/options.c +11 -0
index 3753810..3ceada0 100644
@@ -3527,7 +3527,13 @@
 #endif /* if defined(_WIN32) */
 
     /* Copy --dns options to tuntap_options */
+
     const struct dns_domain *d = dns->search_domains;
+    if (d)
+    {
+        tt->domain_search_list_len = 0;
+    }
+
     while (d && tt->domain_search_list_len + 1 < N_SEARCH_LIST_LEN)
     {
         tt->domain_search_list[tt->domain_search_list_len++] = d->name;
@@ -3538,6 +3544,9 @@
         msg(M_WARN, "WARNING: couldn't copy all --dns search-domains to TUN/TAP");
     }
 
+    tt->dns_len = 0;
+    tt->dns6_len = 0;
+
     const struct dns_server *s = dns->servers;
     while (s)
     {
@@ -6212,6 +6221,8 @@
             }
             o->disable_nbt = 0;
             o->dhcp_options = 0;
+
+            CLEAR(options->dns_options.from_dhcp);
 #if defined(TARGET_ANDROID)
             o->http_proxy_port = 0;
             o->http_proxy = NULL;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1121?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ife4d8fc5f8e2183e61226d66a76bbaa02c06f787
Gerrit-Change-Number: 1121
Gerrit-PatchSet: 4
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged